package com.ruoyi.framework.utils;

import com.ruoyi.system.mapper.CommonMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FlowIdUtil {

    /**
     * 合同编号流水号
     */
    private static final long FLOW_TYPE_CONTRACT = 1L;
    /**
     * 客户编号流水号
     */
    private static final long FLOW_TYPE_CUSTOMER = 3L;

    @Autowired
    private CommonMapper commonMapper;

    public synchronized String getContractNextFlowId() {
        return String.valueOf(commonMapper.getFlowId(FLOW_TYPE_CONTRACT));
    }

    public synchronized String getCustomerNextFlowId() {
        return String.valueOf(commonMapper.getFlowId(FLOW_TYPE_CUSTOMER));
    }
}
